package com.inifitness.admin.core.system.converter;


import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.inifitness.admin.core.system.model.entity.SysRole;
import com.inifitness.admin.core.system.model.form.RoleForm;
import com.inifitness.admin.core.system.model.vo.RolePageVO;
import com.inifitness.common.model.Option;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * 角色对象转换器
 *
 * @author sunjinfeng
 * @since 2024/04/18 11:00:00
 */
@Mapper(componentModel = "spring")
public interface RoleConverter {

  Page<RolePageVO> entity2Page(Page<SysRole> page);


  @Mapping(target = "value", source = "id")
  @Mapping(target = "label", source = "name")
  Option entity2Option(SysRole role);


  List<Option> entities2Options(List<SysRole> roles);

  SysRole form2Entity(RoleForm roleForm);

  RoleForm entity2Form(SysRole entity);
}